package com.android.yummycookies.model.cookie;

import android.graphics.Bitmap;

import com.android.yummycookies.types.SpriteType;
import com.android.yummycookies.util.Constant;
import com.android.yummycookies.util.Logger;

public class CookieSpriteFactory {

	private static final String TAG = CookieSpriteFactory.class.getSimpleName();
	
	public static CookieSprite createSprite(SpriteType spriteType, Bitmap bitmap){
		switch (spriteType) {
		case NONE:
			return null;
		case SIMPLE_SPRITE:
			return new CookieSprite(bitmap);
		case MULTIPLE_SPRITE:
			return new MultipleCookieSprite(bitmap, Constant.MULTIPLE_COOKIE_SPRITE_DEFAUT_NB_SPRITES);
		default:
			Logger.logDebug(TAG, "Unknown sprite type: " + spriteType.toString(), spriteType.ordinal());
			throw new IllegalArgumentException("Unknown sprite type: " + spriteType.toString() + "("+  spriteType.ordinal() + ")");
		}
	}

}
